package sky.service.Impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sky.dao.CityDAO;
import sky.domain.City;
import sky.service.CityService;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Gauss
 * Date: 19.05.13
 * Time: 17:33
 * To change this template use File | Settings | File Templates.
 */
@Service
public class CityServiceImpl implements CityService {

    @Autowired
    private CityDAO cityDAO;

    @Override
    @Transactional
    public void addCity(City city) {
        cityDAO.addCity(city);
    }

    @Override
    @Transactional
    public void editCity(City city) {
        cityDAO.editCity(city);
    }

    @Override
    @Transactional
    public void removeCity(Integer id) {
        cityDAO.removeCity(id);
    }

    @Override
    @Transactional
    public City getCityById(Integer id) {
        return cityDAO.getCityById(id);
    }

    @Override
    @Transactional
    public List<City> listCity() {
        return cityDAO.cityList();
    }

    @Override
    public List<String> autocompleteList(String autocompleteString) {
        return cityDAO.autocompleteList(autocompleteString);
    }
}
